﻿using UnityEngine;
using UnityEngine.Events;
using UFrame.BridgeUI.Model;
using UFrame.AssetBundles;

namespace GModule
{
    public class AssetBundleTools_PanelCreateRule : BundleLoader
    {
        IAssetBundleController m_assetCtrl = null;
        public override void InitEnviroment()
        {
            //m_assetCtrl = AssetBundleAgent.Instance;
        }

        /// <summary>
        /// BundleUINode创建对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="assetBundleName"></param>
        /// <param name="assetName"></param>
        /// <param name="onLoad"></param>
        public override void LoadAssetAsync<T>(string assetBundleName, string assetName, System.Action<T> onLoad) 
        {
            if(m_assetCtrl == null)
            {
                Debug.LogError("m_assetCtrl == null");
                return;
            }

            //m_assetCtrl.LoadAssetFromAsync<T>(assetBundleName, assetName, (x) =>
            //{
            //    if (x != null)
            //    {
            //        if (onLoad != null) onLoad(x);
            //    }
            //    else
            //    {
            //        Debug.Log(assetBundleName + ".." + assetName + "-->空");
            //    }
            //});
        }
    }
}